package com.ws.game.lesson2.foe
{
	import com.ws.game.common.framework.BaseCtrl;
	import com.ws.game.common.framework.BaseGameObject;
	import com.ws.game.lesson1.keycontrol.ActionObject;
	import com.ws.log.WSLog;
	public class MonsterCtrl extends BaseCtrl
	{
		public function MonsterCtrl()
		{
		}
		
		override public function set target(value:BaseGameObject):void{
			super.target = value;
			changeDir();
		} 
		
		private function changeDir():void
		{
			var me:ActionObject = _target as ActionObject;
			me.direction = 1+int(Math.random() * 4)
		}
		
		override public function autoRun():void{
			var me:ActionObject = _target as ActionObject;
			if (!me.nextCanMove) 
				changeDir();
		}
	}
}